public class Practice {
    public static int add(int a , int b) {
        return a + b;
    }

    public static double add(double a , double b) {
        return a + b;
    }  //方法的重载：1.方法名一样
       //         2.参数列表：不一样
       //         3.返回值：

    public static int Max(int a ,int b) {
        if(a > b){
            return a;
        }else if(a < b){
            return b;
        }else {
            System.out.println("a = b");
            return -1;
        }
    }

    public static int Max(int a , int b , int c){
        int tmp = Max(a,b);
        return Max(tmp,c);
    }

    public static void print(int a , int b){
        System.out.println(a+" "+b);
    }

    public static void print(int a , int b , int c){
        System.out.println(a+" "+b+""+c);
    }

    public static void print(int...k){
        for (int i = 0; i < k.length; i++) {
            System.out.print(k[i]);
        }
    }

    public static void main1(String[] args) {
        print(1,2);
        print(1,2,3);
        print(1,2,3,4,5,6,7,8,9,0);
    }

    //递归顺序打印多位数
    public static void func (int n){
        if(n<10){
            System.out.println(n);
            return ;
        }
        func(n / 10);
        System.out.println(n % 10);
    }

    public static void main2(String[] args) {
        func(1234);
    }

    //递归求1+2+3+4+...+10
    public static int sum(int n){
        if(n == 1){
            return 1;
        }
        return n + sum(n-1);
    }

    public static int sum1(int n){
        if(n<10){
            return n;
        }
        return n % 10 + sum1(n / 10);
    }

    public static void main3(String[] args) {
        sum1(123);
    }

    public static void print(int n){
        if(n < 10){
            System.out.print(n);
            return;
        }
        System.out.print(n / 10);
        print(n % 10);
    }

    public static void main4(String[] args) {
        print(1234);
    }

    public static int sum3(int n){
        if(n <10){
            return n;
        }
        return n % 10 + sum3(n / 10);
    }

    public static void main5(String[] args) {
        System.out.println(sum3(123));
    }

    //1 1 2 3 5 8
    public static int fibon(int n){
        if(n == 1 || n == 2 ){
            return 1;
        }
        return fibon(n-1) + fibon(n-2);
    }

    public static void main6(String[] args) {
        System.out.println(fibon(5));
    }

    public static int factorial(int n){
        if(n == 1){
            return n;
        }
        return n * factorial(n-1);
    }

    public static void main7(String[] args) {
        System.out.println(factorial(5));
    }

    public static int sum4(int n){
        if(n == 1){
            return n;
        }
        return n + sum4(n-1);
    }

    public static void main8(String[] args) {
        System.out.println(sum4(10));
    }

    public static int sumFactorial(int n){
        if(n == 1){
            return factorial(n);
        }
        return factorial(n)+sumFactorial(n-1);
    }

    public static void main9(String[] args) {
        System.out.println(sumFactorial(4));
    }

    public static int max(int n , int m){
        if (m > n){
            return m;
        }
        return n;
    }

    public static double max(double n , double m ,double o){
        if (n > m && n > o){
            return n;
        }
        if (m > n && m > o){
            return m;
        }
        return o;
    }

    public static void main(String[] args) {
        System.out.println(max(666,888));
        System.out.println(max(1.2,2.3,3.4));
    }
}
